package com.service_api.controller;

import com.service_api.model.*;
import com.service_api.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin(originPatterns = "*",maxAge = 3600,allowCredentials = "true")
@RestController
@RequestMapping("/api/{city}")
public class DataController {
    @Autowired
    WordCountService wordCountService;

    @Autowired
    CompanyTypeService companyTypeService;

    @Autowired
    CompanySituationService companySituationService;

    @Autowired
    CompanyPeopleService companyPeopleService;

    @Autowired
    DistrictCountService districtCountService;

    @Autowired
    EduExpSalaryService eduExpSalaryService;

    @GetMapping("/districtCount")
    public List<DistrictCount> districtCountList(@PathVariable String city){
        return districtCountService.findByCity(city);
    }

    @GetMapping("/3DBar")
    public List<Object> eduExpSalaryList(@PathVariable String city){
        return eduExpSalaryService.getEduExpSalaryList(city);
    }

    @GetMapping("/companyPeople")
    public List<CompanyPeople> companyPeopleList(@PathVariable String city){
        return companyPeopleService.CompanyPeopleAllByCity(city);
    }

    @GetMapping("/companySituation")
    public List<CompanySituation> companySituationList(@PathVariable String city){
        return companySituationService.getCompanySituationList(city);
    }

    @GetMapping("/companyType")
    public List<CompanyType> companyTypeList(@PathVariable String city){
        return companyTypeService.getCompanyTypeList(city);
    }

    @GetMapping("/wordCount")
    public List<WordCount> wordCountList(@PathVariable String city){
        return wordCountService.getWordCountList(city);
    }

}
